# File: Standard.py
# Copyright 2010 
# Author: Andrew Dorrycott
# License: GNU Lesser General Public License
# Original Repository: http://code.google.com/p/bobthezombie/

import sys
import pygame
import random
import datetime
import math

#version number
__version__ = "0.7.4_1 alpha"

# global_images
PICTURE_DIRECTORY = 'images/'
IMAGES_BOB = {'FaceNorth': PICTURE_DIRECTORY + "Bob-Back_Stand.png",
              'FaceEast': PICTURE_DIRECTORY + "Bob-Right_Stand.png",
              'FaceWest': PICTURE_DIRECTORY + "Bob-Left_Stand.png",
              'FaceSouth': PICTURE_DIRECTORY + "Bob-Front_Stand.png",
              'FaceSouthWest': PICTURE_DIRECTORY + "Bob-Front_Stand.png",
              'FaceSouthEast': PICTURE_DIRECTORY + "Bob-Front_Stand.png",
              'FaceNorthWest': PICTURE_DIRECTORY + "Bob-Back_Stand.png",
              'FaceNorthEast': PICTURE_DIRECTORY + "Bob-Back_Stand.png",
              
              'WalkNorthStep1': PICTURE_DIRECTORY + "Bob-Back_Step1.png",
              'WalkNorthStep2': PICTURE_DIRECTORY + "Bob-Back_Step2.png",
              'WalkEastStep1': PICTURE_DIRECTORY + "Bob-Right_Step1.png",
              'WalkEastStep2': PICTURE_DIRECTORY + "Bob-Right_Step2.png",
              'WalkWestStep1': PICTURE_DIRECTORY + "Bob-Left_Step1.png",
              'WalkWestStep2': PICTURE_DIRECTORY + "Bob-Left_Step2.png",
              'WalkSouthStep1': PICTURE_DIRECTORY + "Bob-Front_Step1.png",
              'WalkSouthStep2': PICTURE_DIRECTORY + "Bob-Front_Step2.png",
              'WalkSouthWestStep1': PICTURE_DIRECTORY + "Bob-Front_Step1.png",
              'WalkSouthWestStep2': PICTURE_DIRECTORY + "Bob-Front_Step2.png",
              'WalkSouthEastStep1': PICTURE_DIRECTORY + "Bob-Front_Step1.png",
              'WalkSouthEastStep2': PICTURE_DIRECTORY + "Bob-Front_Step2.png",
              'WalkNorthWestStep1': PICTURE_DIRECTORY + "Bob-Back_Step1.png",
              'WalkNorthWestStep2': PICTURE_DIRECTORY + "Bob-Back_Step2.png",
              'WalkNorthEastStep1': PICTURE_DIRECTORY + "Bob-Back_Step1.png",
              'WalkNorthEastStep2': PICTURE_DIRECTORY + "Bob-Back_Step2.png",
              
              'EvilFaceNorth': PICTURE_DIRECTORY + "EvilBob-Back_Stand.gif",
              'EvilFaceEast': PICTURE_DIRECTORY + "EvilBob-Right_Stand.gif",
              'EvilFaceWest': PICTURE_DIRECTORY + "EvilBob-Left_Stand.gif",
              'EvilFaceSouth': PICTURE_DIRECTORY + "EvilBob-Front_Stand.gif",
              'EvilFaceSouthWest': PICTURE_DIRECTORY + "EvilBob-Front_Stand.gif",
              'EvilFaceSouthEast': PICTURE_DIRECTORY + "EvilBob-Front_Stand.gif",
              'EvilFaceNorthWest': PICTURE_DIRECTORY + "EvilBob-Back_Stand.gif",
              'EvilFaceNorthEast': PICTURE_DIRECTORY + "EvilBob-Back_Stand.gif",
              
              'EvilWalkNorthStep1': PICTURE_DIRECTORY + "EvilBob-Back_Step1.gif",
              'EvilWalkNorthStep2': PICTURE_DIRECTORY + "EvilBob-Back_Step2.gif",
              'EvilWalkEastStep1': PICTURE_DIRECTORY + "EvilBob-Right_Step1.gif",
              'EvilWalkEastStep2': PICTURE_DIRECTORY + "EvilBob-Right_Step2.gif",
              'EvilWalkWestStep1': PICTURE_DIRECTORY + "EvilBob-Left_Step1.gif",
              'EvilWalkWestStep2': PICTURE_DIRECTORY + "EvilBob-Left_Step2.gif",
              'EvilWalkSouthStep1': PICTURE_DIRECTORY + "EvilBob-Front_Step1.gif",
              'EvilWalkSouthStep2': PICTURE_DIRECTORY + "EvilBob-Front_Step2.gif",
              'EvilWalkSouthWestStep1': PICTURE_DIRECTORY + "EvilBob-Front_Step1.gif",
              'EvilWalkSouthWestStep2': PICTURE_DIRECTORY + "EvilBob-Front_Step2.gif",
              'EvilWalkSouthEastStep1': PICTURE_DIRECTORY + "EvilBob-Front_Step1.gif",
              'EvilWalkSouthEastStep2': PICTURE_DIRECTORY + "EvilBob-Front_Step2.gif",
              'EvilWalkNorthWestStep1': PICTURE_DIRECTORY + "EvilBob-Back_Step1.gif",
              'EvilWalkNorthWestStep2': PICTURE_DIRECTORY + "EvilBob-Back_Step2.gif",
              'EvilWalkNorthEastStep1': PICTURE_DIRECTORY + "EvilBob-Back_Step1.gif",
              'EvilWalkNorthEastStep2': PICTURE_DIRECTORY + "EvilBob-Back_Step2.gif",
              
              'CollisionMask': PICTURE_DIRECTORY + "Bob-Front_Stand.png",}

IMAGES_INTERN = {'FaceNorth': PICTURE_DIRECTORY + "Intern-Back_Stand.png",
                 'FaceEast': PICTURE_DIRECTORY + "Intern-Right_Stand.png",
                 'FaceWest': PICTURE_DIRECTORY + "Intern-Left_Stand.png",
                 'FaceSouth': PICTURE_DIRECTORY + "Intern-Front_Stand.png",
                 'FaceSouthWest': PICTURE_DIRECTORY + "Intern-Front_Stand.png",
                 'FaceSouthEast': PICTURE_DIRECTORY + "Intern-Front_Stand.png",
                 'FaceNorthWest': PICTURE_DIRECTORY + "Intern-Back_Stand.png",
                 'FaceNorthEast': PICTURE_DIRECTORY + "Intern-Back_Stand.png",
                 
                 'WalkNorthStep1': PICTURE_DIRECTORY + "Intern-Back_Step1.png",
                 'WalkNorthStep2': PICTURE_DIRECTORY + "Intern-Back_Step2.png",
                 'WalkEastStep1': PICTURE_DIRECTORY + "Intern-Right_Step1.png",
                 'WalkEastStep2': PICTURE_DIRECTORY + "Intern-Right_Step2.png",
                 'WalkWestStep1': PICTURE_DIRECTORY + "Intern-Left_Step1.png",
                 'WalkWestStep2': PICTURE_DIRECTORY + "Intern-Left_Step2.png",
                 'WalkSouthStep1': PICTURE_DIRECTORY + "Intern-Front_Step1.png",
                 'WalkSouthStep2': PICTURE_DIRECTORY + "Intern-Front_Step2.png",
                 'WalkSouthWestStep1': PICTURE_DIRECTORY + "Intern-Front_Step1.png",
                 'WalkSouthWestStep2': PICTURE_DIRECTORY + "Intern-Front_Step2.png",
                 'WalkSouthEastStep1': PICTURE_DIRECTORY + "Intern-Front_Step1.png",
                 'WalkSouthEastStep2': PICTURE_DIRECTORY + "Intern-Front_Step2.png",
                 'WalkNorthWestStep1': PICTURE_DIRECTORY + "Intern-Back_Step1.png",
                 'WalkNorthWestStep2': PICTURE_DIRECTORY + "Intern-Back_Step2.png",
                 'WalkNorthEastStep1': PICTURE_DIRECTORY + "Intern-Back_Step1.png",
                 'WalkNorthEastStep2': PICTURE_DIRECTORY + "Intern-Back_Step2.png",
                 
                 'CollisionMask': PICTURE_DIRECTORY + "Intern-Front_Stand.png",}

IMAGES_ZOMBIE_INTERN = {'FaceNorth': PICTURE_DIRECTORY + "ZombieIntern-Back_Stand.png",
                        'FaceEast': PICTURE_DIRECTORY + "ZombieIntern-Right_Stand.png",
                        'FaceWest': PICTURE_DIRECTORY + "ZombieIntern-Left_Stand.png",
                        'FaceSouth': PICTURE_DIRECTORY + "ZombieIntern-Front_Stand.png",
                        'FaceSouthWest': PICTURE_DIRECTORY + "ZombieIntern-Front_Stand.png",
                        'FaceSouthEast': PICTURE_DIRECTORY + "ZombieIntern-Front_Stand.png",
                        'FaceNorthWest': PICTURE_DIRECTORY + "ZombieIntern-Back_Stand.png",
                        'FaceNorthEast': PICTURE_DIRECTORY + "ZombieIntern-Back_Stand.png",
                        
                        'WalkNorthStep1': PICTURE_DIRECTORY + "ZombieIntern-Back_Step1.png",
                        'WalkNorthStep2': PICTURE_DIRECTORY + "ZombieIntern-Back_Step2.png",
                        'WalkEastStep1': PICTURE_DIRECTORY + "ZombieIntern-Right_Step1.png",
                        'WalkEastStep2': PICTURE_DIRECTORY + "ZombieIntern-Right_Step2.png",
                        'WalkWestStep1': PICTURE_DIRECTORY + "ZombieIntern-Left_Step1.png",
                        'WalkWestStep2': PICTURE_DIRECTORY + "ZombieIntern-Left_Step2.png",
                        'WalkSouthStep1': PICTURE_DIRECTORY + "ZombieIntern-Front_Step1.png",
                        'WalkSouthStep2': PICTURE_DIRECTORY + "ZombieIntern-Front_Step2.png",
                        'WalkSouthWestStep1': PICTURE_DIRECTORY + "ZombieIntern-Front_Step1.png",
                        'WalkSouthWestStep2': PICTURE_DIRECTORY + "ZombieIntern-Front_Step2.png",
                        'WalkSouthEastStep1': PICTURE_DIRECTORY + "ZombieIntern-Front_Step1.png",
                        'WalkSouthEastStep2': PICTURE_DIRECTORY + "ZombieIntern-Front_Step2.png",
                        'WalkNorthWestStep1': PICTURE_DIRECTORY + "ZombieIntern-Back_Step1.png",
                        'WalkNorthWestStep2': PICTURE_DIRECTORY + "ZombieIntern-Back_Step2.png",
                        'WalkNorthEastStep1': PICTURE_DIRECTORY + "ZombieIntern-Back_Step1.png",
                        'WalkNorthEastStep2': PICTURE_DIRECTORY + "ZombieIntern-Back_Step2.png",
                        
                        'CollisionMask': PICTURE_DIRECTORY + "ZombieIntern-Front_Stand.png",}

IMAGES_FEMALE = {'FaceNorth': PICTURE_DIRECTORY + "Female-Back_Stand.png",
                 'FaceEast': PICTURE_DIRECTORY + "Female-Right_Stand.png",
                 'FaceWest': PICTURE_DIRECTORY + "Female-Left_Stand.png",
                 'FaceSouth': PICTURE_DIRECTORY + "Female-Front_Stand.png",
                 'FaceSouthWest': PICTURE_DIRECTORY + "Female-Front_Stand.png",
                 'FaceSouthEast': PICTURE_DIRECTORY + "Female-Front_Stand.png",
                 'FaceNorthWest': PICTURE_DIRECTORY + "Female-Back_Stand.png",
                 'FaceNorthEast': PICTURE_DIRECTORY + "Female-Back_Stand.png",
                 
                 'WalkNorthStep1': PICTURE_DIRECTORY + "Female-Back_Step1.png",
                 'WalkNorthStep2': PICTURE_DIRECTORY + "Female-Back_Step2.png",
                 'WalkEastStep1': PICTURE_DIRECTORY + "Female-Right_Step1.png",
                 'WalkEastStep2': PICTURE_DIRECTORY + "Female-Right_Step2.png",
                 'WalkWestStep1': PICTURE_DIRECTORY + "Female-Left_Step1.png",
                 'WalkWestStep2': PICTURE_DIRECTORY + "Female-Left_Step2.png",
                 'WalkSouthStep1': PICTURE_DIRECTORY + "Female-Front_Step1.png",
                 'WalkSouthStep2': PICTURE_DIRECTORY + "Female-Front_Step2.png",
                 'WalkSouthWestStep1': PICTURE_DIRECTORY + "Female-Front_Step1.png",
                 'WalkSouthWestStep2': PICTURE_DIRECTORY + "Female-Front_Step2.png",
                 'WalkSouthEastStep1': PICTURE_DIRECTORY + "Female-Front_Step1.png",
                 'WalkSouthEastStep2': PICTURE_DIRECTORY + "Female-Front_Step2.png",
                 'WalkNorthWestStep1': PICTURE_DIRECTORY + "Female-Back_Step1.png",
                 'WalkNorthWestStep2': PICTURE_DIRECTORY + "Female-Back_Step2.png",
                 'WalkNorthEastStep1': PICTURE_DIRECTORY + "Female-Back_Step1.png",
                 'WalkNorthEastStep2': PICTURE_DIRECTORY + "Female-Back_Step2.png",
                 
                 'CollisionMask': PICTURE_DIRECTORY + "Female-Front_Stand.png",}

IMAGES_ZOMBIE_FEMALE = {'FaceNorth': PICTURE_DIRECTORY + "ZombieFemale-Back_Stand.png",
                 'FaceEast': PICTURE_DIRECTORY + "ZombieFemale-Right_Stand.png",
                 'FaceWest': PICTURE_DIRECTORY + "ZombieFemale-Left_Stand.png",
                 'FaceSouth': PICTURE_DIRECTORY + "ZombieFemale-Front_Stand.png",
                 'FaceSouthWest': PICTURE_DIRECTORY + "ZombieFemale-Front_Stand.png",
                 'FaceSouthEast': PICTURE_DIRECTORY + "ZombieFemale-Front_Stand.png",
                 'FaceNorthWest': PICTURE_DIRECTORY + "ZombieFemale-Back_Stand.png",
                 'FaceNorthEast': PICTURE_DIRECTORY + "ZombieFemale-Back_Stand.png",
                 
                 'WalkNorthStep1': PICTURE_DIRECTORY + "ZombieFemale-Back_Step1.png",
                 'WalkNorthStep2': PICTURE_DIRECTORY + "ZombieFemale-Back_Step2.png",
                 'WalkEastStep1': PICTURE_DIRECTORY + "ZombieFemale-Right_Step1.png",
                 'WalkEastStep2': PICTURE_DIRECTORY + "ZombieFemale-Right_Step2.png",
                 'WalkWestStep1': PICTURE_DIRECTORY + "ZombieFemale-Left_Step1.png",
                 'WalkWestStep2': PICTURE_DIRECTORY + "ZombieFemale-Left_Step2.png",
                 'WalkSouthStep1': PICTURE_DIRECTORY + "ZombieFemale-Front_Step1.png",
                 'WalkSouthStep2': PICTURE_DIRECTORY + "ZombieFemale-Front_Step2.png",
                 'WalkSouthWestStep1': PICTURE_DIRECTORY + "ZombieFemale-Front_Step1.png",
                 'WalkSouthWestStep2': PICTURE_DIRECTORY + "ZombieFemale-Front_Step2.png",
                 'WalkSouthEastStep1': PICTURE_DIRECTORY + "ZombieFemale-Front_Step1.png",
                 'WalkSouthEastStep2': PICTURE_DIRECTORY + "ZombieFemale-Front_Step2.png",
                 'WalkNorthWestStep1': PICTURE_DIRECTORY + "ZombieFemale-Back_Step1.png",
                 'WalkNorthWestStep2': PICTURE_DIRECTORY + "ZombieFemale-Back_Step2.png",
                 'WalkNorthEastStep1': PICTURE_DIRECTORY + "ZombieFemale-Back_Step1.png",
                 'WalkNorthEastStep2': PICTURE_DIRECTORY + "ZombieFemale-Back_Step2.png",
                 
                 'CollisionMask': PICTURE_DIRECTORY + "ZombieFemale-Front_Stand.png",}

IMAGES_MALE = {'FaceNorth': PICTURE_DIRECTORY + "Male-Back_Stand.png",
               'FaceEast': PICTURE_DIRECTORY + "Male-Right_Stand.png",
               'FaceWest': PICTURE_DIRECTORY + "Male-Left_Stand.png",
               'FaceSouth': PICTURE_DIRECTORY + "Male-Front_Stand.png",
               'FaceSouthWest': PICTURE_DIRECTORY + "Male-Front_Stand.png",
               'FaceSouthEast': PICTURE_DIRECTORY + "Male-Front_Stand.png",
               'FaceNorthWest': PICTURE_DIRECTORY + "Male-Back_Stand.png",
               'FaceNorthEast': PICTURE_DIRECTORY + "Male-Back_Stand.png",
               
               'WalkNorthStep1': PICTURE_DIRECTORY + "Male-Back_Step1.png",
               'WalkNorthStep2': PICTURE_DIRECTORY + "Male-Back_Step2.png",
               'WalkEastStep1': PICTURE_DIRECTORY + "Male-Right_Step1.png",
               'WalkEastStep2': PICTURE_DIRECTORY + "Male-Right_Step2.png",
               'WalkWestStep1': PICTURE_DIRECTORY + "Male-Left_Step1.png",
               'WalkWestStep2': PICTURE_DIRECTORY + "Male-Left_Step2.png",
               'WalkSouthStep1': PICTURE_DIRECTORY + "Male-Front_Step1.png",
               'WalkSouthStep2': PICTURE_DIRECTORY + "Male-Front_Step2.png",
               'WalkSouthWestStep1': PICTURE_DIRECTORY + "Male-Front_Step1.png",
               'WalkSouthWestStep2': PICTURE_DIRECTORY + "Male-Front_Step2.png",
               'WalkSouthEastStep1': PICTURE_DIRECTORY + "Male-Front_Step1.png",
               'WalkSouthEastStep2': PICTURE_DIRECTORY + "Male-Front_Step2.png",
               'WalkNorthWestStep1': PICTURE_DIRECTORY + "Male-Back_Step1.png",
               'WalkNorthWestStep2': PICTURE_DIRECTORY + "Male-Back_Step2.png",
               'WalkNorthEastStep1': PICTURE_DIRECTORY + "Male-Back_Step1.png",
               'WalkNorthEastStep2': PICTURE_DIRECTORY + "Male-Back_Step2.png",
               
               'CollisionMask': PICTURE_DIRECTORY + "Male-Front_Stand.png",}

IMAGES_ZOMBIE_MALE = {'FaceNorth': PICTURE_DIRECTORY + "ZombieMale-Back_Stand.png",
               'FaceEast': PICTURE_DIRECTORY + "ZombieMale-Right_Stand.png",
               'FaceWest': PICTURE_DIRECTORY + "ZombieMale-Left_Stand.png",
               'FaceSouth': PICTURE_DIRECTORY + "ZombieMale-Front_Stand.png",
               'FaceSouthWest': PICTURE_DIRECTORY + "ZombieMale-Front_Stand.png",
               'FaceSouthEast': PICTURE_DIRECTORY + "ZombieMale-Front_Stand.png",
               'FaceNorthWest': PICTURE_DIRECTORY + "ZombieMale-Back_Stand.png",
               'FaceNorthEast': PICTURE_DIRECTORY + "ZombieMale-Back_Stand.png",
               
               'WalkNorthStep1': PICTURE_DIRECTORY + "ZombieMale-Back_Step1.png",
               'WalkNorthStep2': PICTURE_DIRECTORY + "ZombieMale-Back_Step2.png",
               'WalkEastStep1': PICTURE_DIRECTORY + "ZombieMale-Right_Step1.png",
               'WalkEastStep2': PICTURE_DIRECTORY + "ZombieMale-Right_Step2.png",
               'WalkWestStep1': PICTURE_DIRECTORY + "ZombieMale-Left_Step1.png",
               'WalkWestStep2': PICTURE_DIRECTORY + "ZombieMale-Left_Step2.png",
               'WalkSouthStep1': PICTURE_DIRECTORY + "ZombieMale-Front_Step1.png",
               'WalkSouthStep2': PICTURE_DIRECTORY + "ZombieMale-Front_Step2.png",
               'WalkSouthWestStep1': PICTURE_DIRECTORY + "ZombieMale-Front_Step1.png",
               'WalkSouthWestStep2': PICTURE_DIRECTORY + "ZombieMale-Front_Step2.png",
               'WalkSouthEastStep1': PICTURE_DIRECTORY + "ZombieMale-Front_Step1.png",
               'WalkSouthEastStep2': PICTURE_DIRECTORY + "ZombieMale-Front_Step2.png",
               'WalkNorthWestStep1': PICTURE_DIRECTORY + "ZombieMale-Back_Step1.png",
               'WalkNorthWestStep2': PICTURE_DIRECTORY + "ZombieMale-Back_Step2.png",
               'WalkNorthEastStep1': PICTURE_DIRECTORY + "ZombieMale-Back_Step1.png",
               'WalkNorthEastStep2': PICTURE_DIRECTORY + "ZombieMale-Back_Step2.png",
               
               'CollisionMask': PICTURE_DIRECTORY + "ZombieMale-Front_Stand.png",}

# World and world boundaries
IMAGES_WORLD = PICTURE_DIRECTORY + "world.png"
IMAGES_BOUNDARY = PICTURE_DIRECTORY + "boundaries.png"

# Menu Background images
IMAGES_MENU_BACKGROUND_BORDER = PICTURE_DIRECTORY + 'menu_background_border.gif'
IMAGES_MENU_BACKGROUND_INNER = PICTURE_DIRECTORY + 'menu_background_inner.gif'
IMAGES_DNA_BAR_EMPTY = PICTURE_DIRECTORY + "DNA_bar_empty.png"
IMAGES_DNA_BAR_FULL = PICTURE_DIRECTORY + "DNA_bar_full.png"

# Items
IMAGES_SYRINGE = {1: PICTURE_DIRECTORY + "DNA_Syringe.png",
                 2: PICTURE_DIRECTORY + "DNA_Syringe_Blue.png",
                 3: PICTURE_DIRECTORY + "DNA_Syringe_Gold.png",
                 4: PICTURE_DIRECTORY + "DNA_Syringe_Orange.png",
                 5: PICTURE_DIRECTORY + "DNA_Syringe_Red.png",
                 }
IMAGES_DOCUMENT = PICTURE_DIRECTORY + "Document.png"
IMAGES_DNA = PICTURE_DIRECTORY + "DNA_Helix.gif"
IMAGES_MEAT = {1: PICTURE_DIRECTORY + "Meat1.png",
               2: PICTURE_DIRECTORY + "Meat2.png",
               }
IMAGES_PISTOL_AMMO = PICTURE_DIRECTORY + "Ammo_Pistol.png"
IMAGES_RIFLE_AMMO = PICTURE_DIRECTORY + "Ammo_Rifle.png"
IMAGES_SHOTGUN_AMMO = PICTURE_DIRECTORY + "Ammo_Shotgun.png"
IMAGES_DISGUISES = {1: PICTURE_DIRECTORY + "Disguise_Bob-Suit.png",
                    2: PICTURE_DIRECTORY + "Disguise_EvilBob-Suit.png",
                    3: PICTURE_DIRECTORY + "Disguise_LabCoat.png",
                    }

# Effects
IMAGES_BULLET = {1: PICTURE_DIRECTORY + "Bullet_Pistol.png",
                 2: PICTURE_DIRECTORY + "Bullet_Rifle.png",
                 }
IMAGES_POP = {1: PICTURE_DIRECTORY + "Pop1.gif",
              2: PICTURE_DIRECTORY + "Pop2.gif",
              }
IMAGES_MUZZLE_FLASH_SHOTGUN = PICTURE_DIRECTORY + "MuzzleFlash_Shotgun.gif"
IMAGES_MUZZLE_FLASH_PISTOL = PICTURE_DIRECTORY + "MuzzleFlash_Pistol.gif"
IMAGES_MUZZLE_FLASH_RIFLE = PICTURE_DIRECTORY + "MuzzleFlash_Right.gif"
IMAGES_BLOOD_SPLAT = {1: PICTURE_DIRECTORY + "Blood_Splatter1.png",
                      2: PICTURE_DIRECTORY + "Blood_Splatter2.png",
                      3: PICTURE_DIRECTORY + "Blood_Splatter3.png",
                      }

IMAGES_BLACK_OUT = PICTURE_DIRECTORY + "blank_image.gif"

# Weapons
IMAGES_PISTOL = PICTURE_DIRECTORY + "Weapon_Pistol.png"
IMAGES_RIFLE = PICTURE_DIRECTORY + "Weapon_Rifle.png"
IMAGES_SHOTGUN = PICTURE_DIRECTORY + "Weapon_Shotgun.png"

# Global Engine Mechanics
MOVEMENT_SPEED = 1

# Global Event Mechanics
class CustomEvents():
    died = pygame.USEREVENT + 1
    cured = pygame.USEREVENT + 2
    converted = pygame.USEREVENT + 3
    quit_game = pygame.USEREVENT + 4
    new_game = pygame.USEREVENT + 5
    picked_up_item = pygame.USEREVENT + 6
    zombie_apocalypse = pygame.USEREVENT + 7
    rampage = pygame.USEREVENT + 8

class WorldObject(pygame.sprite.Sprite):
    def __init__(self, x, y, engine, view_image, collision_image, scale = 1.0):
        pygame.sprite.Sprite.__init__(self)
        
        # Debug
        self.world_x = x
        self.world_y = y
        
        # Remembered Variables
        self.current_scale = scale
        self.current_x = x
        self.current_y = y
        self.engine = engine
        self.scale = scale
        
        # Display Image
        self.view_image = pygame.image.load(view_image)
        self.view_image = pygame.transform.scale(self.view_image, (int( self.view_image.get_size()[0] * scale ), int( self.view_image.get_size()[1] * scale ) ))
        self.view_rectangle = self.view_image.get_rect()
        self.view_rectangle.x = self.current_x - (self.view_rectangle.width / 2.0)
        self.view_rectangle.y = self.current_y - (self.view_rectangle.height / 2.0)
        
        ##########
        # Warning!
        ##########
        #
        # Sprite.collision_mask looks at self.image, self.rect only if self.mask is missing
        # If self.mask is missing the engine will have expensive collision dection due to contasnt
        # building of the mask for each object in the world
        #
        # Collision Mask gives the engine a solid unchanging hit box
        
        self.image = pygame.image.load(collision_image)
        self.image = pygame.transform.scale(self.image, (int( self.image.get_size()[0] * scale ), int( self.image.get_size()[1] * scale ) ))
        self.mask = pygame.sprite.from_surface(self.image) # This is what is pulled for collision
        self.rect = self.image.get_rect()
        self.rect.x = self.current_x - (self.rect.width / 2.0)
        self.rect.y = self.current_y - (self.rect.height / 2.0)
        
        self.image.set_alpha(0) # The player should not see the boundaries
    
    def Rescale(self, scalor):
        self.view_image = pygame.transform.scale(self.image, (int( self.view_rectangle.width * scalor ), int( self.view_rectangle.height * scalor )))
        self.view_rectangle = self.image.get_rect()
        self.view_rectangle.x = self.current_x - (self.view_rectangle.width / 2.0)
        self.view_rectangle.y = self.current_y - (self.view_rectangle.height / 2.0)
        
        # Collision Mask
        self.image = pygame.transform.scale(self.image, (int( self.image.get_size()[0] * scalor ), int( self.image.get_size()[1] * scalor ) ))
        self.rect = self.image.get_rect()
        self.rect.x = self.current_x - (self.rect.width / 2.0)
        self.rect.y = self.current_y - (self.rect.height / 2.0)
    
    def Redraw(self, screen):
        screen.blit(self.view_image, self.view_rectangle)
    
    def MoveSouth(self, speed):
        # This is reverse of bob's movement
        self.current_y -= speed
        self.world_y -= speed
        self.view_rectangle = self.view_rectangle.move( [0, speed * -1] )
        self.rect = self.rect.move( [0, speed * -1] )
    
    def MoveNorth(self, speed):
        # This is reverse of bob's movement
        self.current_y += speed
        self.world_y += speed
        self.view_rectangle = self.view_rectangle.move( [0, speed] )
        self.rect = self.rect.move( [0, speed] )
    
    def MoveWest(self, speed):
        # This is reverse of bob's movement
        self.current_x += speed
        self.world_x += speed
        self.view_rectangle = self.view_rectangle.move( [speed, 0] )
        self.rect = self.rect.move( [speed, 0] )
    
    def MoveEast(self, speed):
        # This is reverse of bob's movement
        self.current_x -= speed
        self.world_x -= speed
        self.view_rectangle = self.view_rectangle.move( [speed * -1, 0] )
        self.rect = self.rect.move( [speed * -1, 0] )
    
    def WillCollideWithBoundariesAt(self):
        """ Force children to overload this method """
        pass
